#include <vector>
#include <queue>

using namespace std;

class Solution {
public:
    int findKthLargest(vector<int>& nums, int k) {
        priority_queue<int, vector<int>, greater<int>> queue;
        for (int val : nums) {
            queue.push(val);
            if (queue.size() > k) {
                queue.pop();
            }
        }
        return queue.top();
    }
};
